/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.spreedairy.portal.service.persistence;

import com.liferay.portal.kernel.bean.PortletBeanLocatorUtil;
import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.ReferenceRegistry;
import com.liferay.portal.service.ServiceContext;

import com.spreedairy.portal.model.CustomField;

import java.util.List;

/**
 * The persistence utility for the custom field service. This utility wraps {@link CustomFieldPersistenceImpl} and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class.
 *
 * <p>
 * Caching information and settings can be found in <code>portal.properties</code>
 * </p>
 *
 * @author SpreeDairy
 * @see CustomFieldPersistence
 * @see CustomFieldPersistenceImpl
 * @generated
 */
public class CustomFieldUtil {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
	 */

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
	 */
	public static void clearCache() {
		getPersistence().clearCache();
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
	 */
	public static void clearCache(CustomField customField) {
		getPersistence().clearCache(customField);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
	 */
	public long countWithDynamicQuery(DynamicQuery dynamicQuery)
		throws SystemException {
		return getPersistence().countWithDynamicQuery(dynamicQuery);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
	 */
	public static List<CustomField> findWithDynamicQuery(
		DynamicQuery dynamicQuery) throws SystemException {
		return getPersistence().findWithDynamicQuery(dynamicQuery);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
	 */
	public static List<CustomField> findWithDynamicQuery(
		DynamicQuery dynamicQuery, int start, int end)
		throws SystemException {
		return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
	 */
	public static List<CustomField> findWithDynamicQuery(
		DynamicQuery dynamicQuery, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		return getPersistence()
				   .findWithDynamicQuery(dynamicQuery, start, end,
			orderByComparator);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
	 */
	public static CustomField update(CustomField customField, boolean merge)
		throws SystemException {
		return getPersistence().update(customField, merge);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
	 */
	public static CustomField update(CustomField customField, boolean merge,
		ServiceContext serviceContext) throws SystemException {
		return getPersistence().update(customField, merge, serviceContext);
	}

	/**
	* Caches the custom field in the entity cache if it is enabled.
	*
	* @param customField the custom field
	*/
	public static void cacheResult(
		com.spreedairy.portal.model.CustomField customField) {
		getPersistence().cacheResult(customField);
	}

	/**
	* Caches the custom fields in the entity cache if it is enabled.
	*
	* @param customFields the custom fields
	*/
	public static void cacheResult(
		java.util.List<com.spreedairy.portal.model.CustomField> customFields) {
		getPersistence().cacheResult(customFields);
	}

	/**
	* Creates a new custom field with the primary key. Does not add the custom field to the database.
	*
	* @param recId the primary key for the new custom field
	* @return the new custom field
	*/
	public static com.spreedairy.portal.model.CustomField create(long recId) {
		return getPersistence().create(recId);
	}

	/**
	* Removes the custom field with the primary key from the database. Also notifies the appropriate model listeners.
	*
	* @param recId the primary key of the custom field
	* @return the custom field that was removed
	* @throws com.spreedairy.portal.NoSuchCustomFieldException if a custom field with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.spreedairy.portal.model.CustomField remove(long recId)
		throws com.liferay.portal.kernel.exception.SystemException,
			com.spreedairy.portal.NoSuchCustomFieldException {
		return getPersistence().remove(recId);
	}

	public static com.spreedairy.portal.model.CustomField updateImpl(
		com.spreedairy.portal.model.CustomField customField, boolean merge)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().updateImpl(customField, merge);
	}

	/**
	* Returns the custom field with the primary key or throws a {@link com.spreedairy.portal.NoSuchCustomFieldException} if it could not be found.
	*
	* @param recId the primary key of the custom field
	* @return the custom field
	* @throws com.spreedairy.portal.NoSuchCustomFieldException if a custom field with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.spreedairy.portal.model.CustomField findByPrimaryKey(
		long recId)
		throws com.liferay.portal.kernel.exception.SystemException,
			com.spreedairy.portal.NoSuchCustomFieldException {
		return getPersistence().findByPrimaryKey(recId);
	}

	/**
	* Returns the custom field with the primary key or returns <code>null</code> if it could not be found.
	*
	* @param recId the primary key of the custom field
	* @return the custom field, or <code>null</code> if a custom field with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.spreedairy.portal.model.CustomField fetchByPrimaryKey(
		long recId) throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().fetchByPrimaryKey(recId);
	}

	/**
	* Returns all the custom fields where categoryId = &#63;.
	*
	* @param categoryId the category ID
	* @return the matching custom fields
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.spreedairy.portal.model.CustomField> findByCategoryId(
		long categoryId)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findByCategoryId(categoryId);
	}

	/**
	* Returns a range of all the custom fields where categoryId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param categoryId the category ID
	* @param start the lower bound of the range of custom fields
	* @param end the upper bound of the range of custom fields (not inclusive)
	* @return the range of matching custom fields
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.spreedairy.portal.model.CustomField> findByCategoryId(
		long categoryId, int start, int end)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findByCategoryId(categoryId, start, end);
	}

	/**
	* Returns an ordered range of all the custom fields where categoryId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param categoryId the category ID
	* @param start the lower bound of the range of custom fields
	* @param end the upper bound of the range of custom fields (not inclusive)
	* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	* @return the ordered range of matching custom fields
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.spreedairy.portal.model.CustomField> findByCategoryId(
		long categoryId, int start, int end,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .findByCategoryId(categoryId, start, end, orderByComparator);
	}

	/**
	* Returns the first custom field in the ordered set where categoryId = &#63;.
	*
	* @param categoryId the category ID
	* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	* @return the first matching custom field
	* @throws com.spreedairy.portal.NoSuchCustomFieldException if a matching custom field could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.spreedairy.portal.model.CustomField findByCategoryId_First(
		long categoryId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException,
			com.spreedairy.portal.NoSuchCustomFieldException {
		return getPersistence()
				   .findByCategoryId_First(categoryId, orderByComparator);
	}

	/**
	* Returns the first custom field in the ordered set where categoryId = &#63;.
	*
	* @param categoryId the category ID
	* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	* @return the first matching custom field, or <code>null</code> if a matching custom field could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.spreedairy.portal.model.CustomField fetchByCategoryId_First(
		long categoryId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .fetchByCategoryId_First(categoryId, orderByComparator);
	}

	/**
	* Returns the last custom field in the ordered set where categoryId = &#63;.
	*
	* @param categoryId the category ID
	* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	* @return the last matching custom field
	* @throws com.spreedairy.portal.NoSuchCustomFieldException if a matching custom field could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.spreedairy.portal.model.CustomField findByCategoryId_Last(
		long categoryId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException,
			com.spreedairy.portal.NoSuchCustomFieldException {
		return getPersistence()
				   .findByCategoryId_Last(categoryId, orderByComparator);
	}

	/**
	* Returns the last custom field in the ordered set where categoryId = &#63;.
	*
	* @param categoryId the category ID
	* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	* @return the last matching custom field, or <code>null</code> if a matching custom field could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.spreedairy.portal.model.CustomField fetchByCategoryId_Last(
		long categoryId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .fetchByCategoryId_Last(categoryId, orderByComparator);
	}

	/**
	* Returns the custom fields before and after the current custom field in the ordered set where categoryId = &#63;.
	*
	* @param recId the primary key of the current custom field
	* @param categoryId the category ID
	* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	* @return the previous, current, and next custom field
	* @throws com.spreedairy.portal.NoSuchCustomFieldException if a custom field with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.spreedairy.portal.model.CustomField[] findByCategoryId_PrevAndNext(
		long recId, long categoryId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException,
			com.spreedairy.portal.NoSuchCustomFieldException {
		return getPersistence()
				   .findByCategoryId_PrevAndNext(recId, categoryId,
			orderByComparator);
	}

	/**
	* Returns the custom field where categoryId = &#63; and fieldOrder = &#63; or throws a {@link com.spreedairy.portal.NoSuchCustomFieldException} if it could not be found.
	*
	* @param categoryId the category ID
	* @param fieldOrder the field order
	* @return the matching custom field
	* @throws com.spreedairy.portal.NoSuchCustomFieldException if a matching custom field could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.spreedairy.portal.model.CustomField findByCategoryIdFieldOrder(
		long categoryId, int fieldOrder)
		throws com.liferay.portal.kernel.exception.SystemException,
			com.spreedairy.portal.NoSuchCustomFieldException {
		return getPersistence()
				   .findByCategoryIdFieldOrder(categoryId, fieldOrder);
	}

	/**
	* Returns the custom field where categoryId = &#63; and fieldOrder = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
	*
	* @param categoryId the category ID
	* @param fieldOrder the field order
	* @return the matching custom field, or <code>null</code> if a matching custom field could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.spreedairy.portal.model.CustomField fetchByCategoryIdFieldOrder(
		long categoryId, int fieldOrder)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .fetchByCategoryIdFieldOrder(categoryId, fieldOrder);
	}

	/**
	* Returns the custom field where categoryId = &#63; and fieldOrder = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
	*
	* @param categoryId the category ID
	* @param fieldOrder the field order
	* @param retrieveFromCache whether to use the finder cache
	* @return the matching custom field, or <code>null</code> if a matching custom field could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.spreedairy.portal.model.CustomField fetchByCategoryIdFieldOrder(
		long categoryId, int fieldOrder, boolean retrieveFromCache)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .fetchByCategoryIdFieldOrder(categoryId, fieldOrder,
			retrieveFromCache);
	}

	/**
	* Returns all the custom fields.
	*
	* @return the custom fields
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.spreedairy.portal.model.CustomField> findAll()
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findAll();
	}

	/**
	* Returns a range of all the custom fields.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param start the lower bound of the range of custom fields
	* @param end the upper bound of the range of custom fields (not inclusive)
	* @return the range of custom fields
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.spreedairy.portal.model.CustomField> findAll(
		int start, int end)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findAll(start, end);
	}

	/**
	* Returns an ordered range of all the custom fields.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param start the lower bound of the range of custom fields
	* @param end the upper bound of the range of custom fields (not inclusive)
	* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	* @return the ordered range of custom fields
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.spreedairy.portal.model.CustomField> findAll(
		int start, int end,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findAll(start, end, orderByComparator);
	}

	/**
	* Removes all the custom fields where categoryId = &#63; from the database.
	*
	* @param categoryId the category ID
	* @throws SystemException if a system exception occurred
	*/
	public static void removeByCategoryId(long categoryId)
		throws com.liferay.portal.kernel.exception.SystemException {
		getPersistence().removeByCategoryId(categoryId);
	}

	/**
	* Removes the custom field where categoryId = &#63; and fieldOrder = &#63; from the database.
	*
	* @param categoryId the category ID
	* @param fieldOrder the field order
	* @return the custom field that was removed
	* @throws SystemException if a system exception occurred
	*/
	public static com.spreedairy.portal.model.CustomField removeByCategoryIdFieldOrder(
		long categoryId, int fieldOrder)
		throws com.liferay.portal.kernel.exception.SystemException,
			com.spreedairy.portal.NoSuchCustomFieldException {
		return getPersistence()
				   .removeByCategoryIdFieldOrder(categoryId, fieldOrder);
	}

	/**
	* Removes all the custom fields from the database.
	*
	* @throws SystemException if a system exception occurred
	*/
	public static void removeAll()
		throws com.liferay.portal.kernel.exception.SystemException {
		getPersistence().removeAll();
	}

	/**
	* Returns the number of custom fields where categoryId = &#63;.
	*
	* @param categoryId the category ID
	* @return the number of matching custom fields
	* @throws SystemException if a system exception occurred
	*/
	public static int countByCategoryId(long categoryId)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().countByCategoryId(categoryId);
	}

	/**
	* Returns the number of custom fields where categoryId = &#63; and fieldOrder = &#63;.
	*
	* @param categoryId the category ID
	* @param fieldOrder the field order
	* @return the number of matching custom fields
	* @throws SystemException if a system exception occurred
	*/
	public static int countByCategoryIdFieldOrder(long categoryId,
		int fieldOrder)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .countByCategoryIdFieldOrder(categoryId, fieldOrder);
	}

	/**
	* Returns the number of custom fields.
	*
	* @return the number of custom fields
	* @throws SystemException if a system exception occurred
	*/
	public static int countAll()
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().countAll();
	}

	public static CustomFieldPersistence getPersistence() {
		if (_persistence == null) {
			_persistence = (CustomFieldPersistence)PortletBeanLocatorUtil.locate(com.spreedairy.portal.service.ClpSerializer.getServletContextName(),
					CustomFieldPersistence.class.getName());

			ReferenceRegistry.registerReference(CustomFieldUtil.class,
				"_persistence");
		}

		return _persistence;
	}

	/**
	 * @deprecated
	 */
	public void setPersistence(CustomFieldPersistence persistence) {
	}

	private static CustomFieldPersistence _persistence;
}